package com.example.boxueguapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.widget.TextView;

import java.util.Timer;
import java.util.TimerTask;

public class StartActivity extends AppCompatActivity {

    private TextView mVersion;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_start);
        init();
    }

    private void findView() {
        mVersion = findViewById(R.id.Version);
    }

    private void init() {
        findView();
        try {
            PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
            mVersion.setText(packageInfo.versionName);
            new Timer().schedule((new TimerTask() {
                @Override
                public void run() {
                    startActivity(new Intent(StartActivity.this,MainActivity.class));
                    finish();
                }
            }),3000);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
    }
}